﻿
@{
    ViewBag.Title = "EmployeePageList";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css{
    <style>
        .bg-light th {
            font-weight: bolder;
            text-align: center;
        }
    </style>
}
<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>防护设施</a>
            </li>
            <li class="crumb-trail">职业健康</li>
        </ol>
    </div>
</header>
<section id="content" class="animated fadeIn" ng-cloak ng-controller="OHSController" ng-init="SearchModel={};page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     PageName='@Request.CurrentExecutionFilePath.Substring(Request.CurrentExecutionFilePath.LastIndexOf("/") + 1)';
     SearchModel={};
           GetDepartmentList();
     GetOHSDevicePageList(SearchModel,page);">

    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="panel">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-filter"></span>搜索过滤
                </span>
            </div>
            <div class="panel-body fill">
                <div class="row">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">设备名称</label>
                        <div class="col-lg-1">
                            <input type="text" ng-model="SearchModel.DeviceName" class="form-control" ng-change="GetOHSDevicePageList(SearchModel,1);" />
                        </div>
                        <label class="col-sm-1 control-label">使用状态</label>
                        <div class="col-lg-1">
                            <select class="form-control" ng-model="SearchModel.Status" ng-change=" GetOHSDevicePageList(SearchModel,1);">
                                <option value="">全部</option>
                                <option value="1">在用</option>
                                <option value="0">停用</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">厂区</label>
                        <div class="col-lg-1">
                            <select class="form-control" ng-model="SearchModel.FactoryArea" ng-change="GetOHSDevicePageList(SearchModel,1);">
                                <option value="">所有厂区</option>
                                <option value="1">浦东</option>
                                <option value="2">大场</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">部门</label>
                        <div class="col-lg-2">
                            <select class="form-control" ng-model="SearchModel.DepartmentId" ng-change="GetOHSDevicePageList(SearchModel,1);">
                                <option value="">所有部门</option>
                                <option ng-repeat="x in DepartmentList" value="{{x.Id}}">{{x.DepartmentName}}</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-info">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-list"></span>防护设施 总数：{{TotalCount}}
                </span>
                <div class="widget-menu pull-right mr10">
                    <div class="btn-group">
                        <a ng-if="@ViewBag.IsAdd==1" href="OHSDeviceImport?page={{result.currentPage}}" class="btn btn-xs btn-primary  light ">
                            <i class="fa fa-plus"></i>导入数据
                        </a>
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                        <tr class="bg-light">
                            <th>序号</th>
                            <th>设备名称</th>
                            <th>数量</th>
                            <th>型号</th>
                            <th>使用状态</th>
                            <th>部门</th>
                            <th>责任人</th>
                            <th>联系方式</th>
                            <th>部门负责人</th>
                            <th>联系方式</th>
                            <th>使用地点</th>
                            <th>投入时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-show="DevicePageList.length==0 && !DataLoading">
                            <td colspan="12" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                        </tr>
                        <tr ng-repeat="x in DevicePageList">
                            <td style="text-align:center;">
                                <span ng-bind="$index+1"></span>
                            </td>
                            <td style="text-align:center;" ng-bind="x.DeviceName"></td>

                            <td ng-bind="x.Quantity"></td>
                            <td style="text-align:center;" ng-bind="x.ModelNo"></td>
                            <td style="text-align:center;"><span ng-show="x.Status==1">在用</span><span ng-show="x.Status==0">停用</span><span ng-show="x.Status==null">/</span></td>
                            <td style="text-align:center;" ng-bind="x.DepartmentName"></td>
                            <td style="text-align:center;" ng-bind="x.Responsible"></td>
                            <td style="text-align:center;" ng-bind="x.ResponsibleContact"></td>
                            <td style="text-align:center;" ng-bind="x.DepLeader"></td>
                            <td style="text-align:center;" ng-bind="x.DepLeaderContact"></td>
                            <td style="text-align:center;" ng-bind="x.FactoryArea + x.Location"></td>
                            <td style="text-align:center;">{{x.StartTime|JSONDate:'yyyy'}}</td>
                            <td>
                                <button ng-if="@ViewBag.IsEdit==1" ng-show="x.Status==0" ng-click="DisableDevice(x.Id,1,result.currentPage,SearchModel);" class="btn btn-info btn-xs btn-label"><i class="fa fa-play"></i> 启用</button>
                                <button ng-if="@ViewBag.IsEdit==1" ng-show="x.Status==1" ng-click="DisableDevice(x.Id,0,result.currentPage,SearchModel);" class="btn btn-warning btn-xs btn-label"><i class="fa fa-stop"></i> 停用</button>
                                <button ng-if="@ViewBag.IsDelete==1" ng-click="DeleteDevice(x.Id,result.currentPage,SearchModel);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash"></i> 删除</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

        </div>
        <div class="text-center" ng-show="DevicePageList!=null && DevicePageList.length>0">
            <ul class="pagination  justify-content-center">
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetOHSDevicePageList(SearchModel,1);">首页</a></li>
                <li class="page-item" ng-class="{'active':result.currentPage==page}" ng-repeat="page in result.pages"><a style="cursor:pointer;" ng-click="GetOHSDevicePageList(SearchModel,page)" class="page-link" ng-bind="page"></a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetOHSDevicePageList(SearchModel,(result.currentPage + 1 > result.totalPage ? result.totalPage : result.currentPage + 1))">下一页</a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetOHSDevicePageList(SearchModel,result.totalPage);">尾页</a></li>
            </ul>
        </div>


    </form>
    <div class="modal fade" id="InfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{RecordDetail.EmployeeInfo.EmployeeName}}{{RecordDetail.CheckDate|JSONDate:'yyyy'}}年体检记录</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeNo" readonly>
                            </div>
                            <label class="col-lg-2 control-label">姓名：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeName" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">性别：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.Gender" readonly>
                            </div>
                            <label class="col-lg-2 control-label">证件号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.IdCardNo" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">体检日期：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.CheckDate" readonly>
                            </div>
                            <label class="col-lg-2 control-label">类型：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.CheckType" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工种：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.WorkType" readonly>
                            </div>
                            <label class="col-lg-2 control-label">接害因素：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.HarmFactor" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结果：</label>
                            <div class="col-lg-8">
                                <textarea rows="3" class="form-control" ng-model="RecordDetail.CheckResult" readonly>
                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结论：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Conclusion" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">医生建议：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Advice" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">检查医院：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Hospital" readonly>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{RecordDetail.EmployeeInfo.EmployeeName}}{{RecordDetail.CheckDate|JSONDate:'yyyy'}}年体检记录</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeNo" readonly>
                            </div>
                            <label class="col-lg-2 control-label">姓名：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeName" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">性别：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.Gender" readonly>
                            </div>
                            <label class="col-lg-2 control-label">证件号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.IdCardNo" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">体检日期：</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="RecordDetail.CheckDate"></datepicker>
                            </div>
                            <label class="col-lg-2 control-label">类型：</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="RecordDetail.CheckTypeId">
                                    <option value="">全部类型</option>
                                    <option value="{{x.Id}}" ng-repeat="x in CheckTypeList">{{x.CheckType}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工种：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.WorkType">
                            </div>
                            <label class="col-lg-2 control-label">接害因素：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.HarmFactor">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结果：</label>
                            <div class="col-lg-8">
                                <textarea rows="3" class="form-control" ng-model="RecordDetail.CheckResult">
                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结论：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Conclusion">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">医生建议：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Advice">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">检查医院：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Hospital">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="EditCheckRecord(RecordDetail,result.currentPage,SearchModel);">修改</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

</section>

@section Js{
    <script src="~/bussiness/js/pg/OHS.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/bussiness/js/libs/moment.min.js"></script>
    <script src="~/bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/bussiness/js/libs/fileinput.js"></script>
    <script src="~/bussiness/js/libs/zh.js"></script>
}
